<div id="headCrop" style="display:none">
    <div class="tailoring-content-one">
        <label title="选择图片" for="chooseImg" class="layui-btn" style="font-weight: normal">
            <input type="file" accept="image/jpg,image/jpeg,image/png" name="file" id="chooseImg" class="hidden" onchange="selectImg(this)"><i class="fa fa-cloud-upload"></i>
            选择图片
        </label>
    </div>
    <div class="ibox-content">
        <div class="tailoring-content">
            <div class="tailoring-content-two">
                <div class="tailoring-box-parcel" style="text-align: center">
                    <img id="tailoringImg">
                    <span class="word" style="position:relative;top:50%;font-size:14px;color: #c2c2c2">仅支持JPG、JPEG、PNG格式的图片文件</span><br>
                    <!--<span class="size" style="position:relative;top:50%;font-size:16px">文件不能大于2MB</span>-->
                </div>
                <div class="preview-box-parcel">
                    <!--<p>图片预览：</p>-->
                    <div class="square previewImg"></div>
                    <div class="circular previewImg"></div>
                </div>
            </div>
        </div>
    </div>
    <div class="modal-footer">
        <span class="layui-btn cropper-reset-btn" style="float:left">复位</span>
        <span class="layui-btn zoomIn" style="float:left">放大</span>
        <span class="layui-btn zoomOut" style="float:left">缩小</span>
        <span class="layui-btn cropper-rotate-btn" style="float:left">旋转</span>
        <span class="layui-btn cropper-scaleX-btn" style="float:left">换向</span>
        <span class="layui-btn " id="sureCut"><i class="fa fa-save"></i> 保存</span>
        <span class="layui-btn layui-btn-primary" onclick="layer.closeAll()"><i class="fa fa-close"></i> 关闭</span>
    </div>
</div>
<script src="__JS__/jquery.min.js?v=2.1.4"></script>
<script src="__JS__/bootstrap.js?v=3.3.7"></script>
<!--<script src="__JS__/content.min.js?v=1.0.0"></script>-->
<!--<script src="__JS__/plugins/chosen/chosen.jquery.js"></script>-->
<!--<script src="__JS__/plugins/iCheck/icheck.min.js"></script>-->
<!--<script src="__JS__/plugins/layer/laydate/laydate.js"></script>-->
<!--<script src="__JS__/plugins/switchery/switchery.js"></script>&lt;!&ndash;IOS开关样式&ndash;&gt;-->
<script src="__JS__/jquery.form.js"></script>
<script src="__JS__/plugins/layui/layui.js"></script>
<!--<script src="__JS__/plugins/layer/layer.js"></script>-->
<script src="__JS__/wk.js"></script>
<!--<script src="__JS__/state.js"></script>-->
<!--<script src="__JS__/plugins/validate/jquery.validate.min.js"></script>-->
<!--<script src="__JS__/plugins/validate/messages_zh.min.js"></script>-->
<script src="__JS__/cropper.min.js"></script>
<script src="__JS__/plugins/footable/footable.all.min.js"></script>
<script src="__JS__/plugins/viewer/viewer.js"></script>
<!--<script src="__JS__/plugins/excel-gen/jszip.js"></script>-->
<!--<script src="__JS__/plugins/excel-gen/FileSaver.js"></script>-->
<!--<script src="__JS__/plugins/excel-gen/excel-gen.js"></script>-->
<!--<script src="__JS__/plugins/swiper/js/swiper.min.js"></script>-->
<script src="__JS__/common.js"></script>
<script src="__JS__/webupload/webuploader.js"></script>
<script src="__JS__/plugins/ueditor/ueditor.config.js" ></script>
<script src="__JS__/plugins/ueditor/ueditor.all.js" ></script>
<script src="__JS__/plugins/zTree/jquery.ztree.core-3.5.js"></script>
<script src="__JS__/plugins/zTree/jquery.ztree.excheck-3.5.js"></script>
<script src="__JS__/plugins/zTree/jquery.ztree.exedit-3.5.js"></script>
<script src="__JS__/plugins/formSelects-v4/formSelects-v4.js"></script>
<script src="__JS__/plugins/wangEditor-3.1.1/release/wangEditor.js" ></script>
<script src="__JS__/plugins/wx-audio/wx-audio.js" ></script>
<script type="text/javascript" src="http://api.map.baidu.com/getscript?v=1.2&ak=293YYtd7X13WphdOyloySdP5M11neeO9&services=&t=20130716024057"></script>

<script>
    //view初始化查看图片
    function view(obj){
        $(obj).viewer({
            url: 'data-original',
        });
    }
    layui.config({
        base: '/src/' //静态资源所在路径
    }).extend({
        index: 'index', //主入口模块
    }).use(['index']),function(){};
</script>
<script>
    //tooltip提示
    $("[data-toggle='tooltip']").tooltip();

    //关闭自动填充
    $('input').attr('autocomplete',"off");

    //view初始化查看图片
    $(function(){
        $('.img-circle').viewer({
            url: 'data-original',
        });
    })
</script>
<script>
    //chose地区三级联动
    function area(obj,type){
        if($(obj).val() == ''){
            if(type == 'province'){
                $("#city").empty();
                $("#city").append('<option value="">---- 所在市 ----</option>');
                $("#city").trigger("chosen:updated");
                $("#district").empty();
                $("#district").append('<option value="">---- 所在区 ----</option>');
                $("#district").trigger("chosen:updated");
            }else if(type == 'city'){
                $("#district").empty();
                $("#district").append('<option value="">---- 所在区 ----</option>');
                $("#district").trigger("chosen:updated");
            }
            return false;
        }
        $.ajax({
            url:"{:url('admin/Base/place')}",
            dataType:"json",
            data:'id='+$(obj).val(),
            type:'post',
            success:function(res){
                var opt = null;
                $.each(res.msg,function(key,vo){
                    opt = opt+"<option value="+vo.district_id+">"+vo.district+"</option>";
                })
                if(type == 'province'){
                    $("#city").empty();
                    $("#city").append('<option value="">---- 所在市 ----</option>');
                    $("#city").append(opt);
                    $("#city").trigger("chosen:updated");
                    $("#district").empty();
                    $("#district").append('<option value="">---- 所在区 ----</option>');
                    $("#district").trigger("chosen:updated");
                }else if(type == 'city'){
                    $("#district").empty();
                    $("#district").append('<option value="">---- 所在区 ----</option>');
                    $("#district").append(opt);
                    $("#district").trigger("chosen:updated");
                }
            }
        })
    }
    //layui三级联动
    layui.use(['form'], function() {
        var form = layui.form
            , layer = layui.layer
        form.on('select(province)', function(data){
            getArea("province",data.value);
        });
        form.on('select(city)', function(data){
            getArea("city",data.value);
        });
        function getArea(type,id){
            $.ajax({
                url:"{:url('admin/Base/place')}",
                dataType:"json",
                data:'id='+id,
                type:'post',
                success:function(res){
                    var opt = '';
                    $.each(res.msg,function(key,vo){
                        opt = opt+"<option value="+vo.district_id+">"+vo.district+"</option>";
                    })
                    if(type=="province"){
                        $("#city").empty();
                        $("#city").append('<option value="">---- 请选择市 ----</option>');
                        $("#district").empty();
                        $("#district").append('<option value="">---- 请选择区 ----</option>');
                        form.render('select','district');
                        $("#city").append(opt);
                        form.render('select','city');
                    }else if(type == "city"){
                        $("#district").empty();
                        $("#district").append('<option value="">---- 请选择区 ----</option>');
                        $("#district").append(opt);
                        form.render('select','district');
                    }
                }
            })
        }
    })
</script>
<script>
    // //tips框
    // $('#offAll').on('mouseover', function(){
    //     var that = this;
    //     layer.tips('<span style="color:#686B6D;"><i class="fa fa-info-circle"></i> 若未勾选默认禁用全部</span>', that,{tips: [2, '#F2F2F2'],time: 10000});
    // });
    // //tips框
    // $('#onAll').on('mouseover', function(){
    //     var that = this;
    //     layer.tips('<span style="color:#686B6D;"><i class="fa fa-info-circle"></i> 若未勾选默认启用全部</span>', that,{tips: [2, '#F2F2F2',''],time: 10000});
    // });
    //tips框
    // $('#excel').on('mouseover', function(){
    //     var that = this;
    //     layer.tips('<span style="color:#686B6D;"><i class="fa fa-info-circle"></i> 导出筛选完成数据</span>', that,{tips: [2, '#F2F2F2',''],time: 10000});
    // });
    // //关闭tips框
    // $('#offAll,#onAll,#export,#excel').on('mouseout', function(){
    //     layer.closeAll('tips');
    // });

    //layui公共操作
    layui.use(['form','table'], function() {
        var form = layui.form
            , layer = layui.layer
            , table = layui.table

        //时间选择器
        wk.lay_date('#start');
        wk.lay_date('#end');
        //重置搜索框
        $('#empty').on('click', function () {
            $('.search').val('');
            // $(".search").trigger("chosen:updated");
            $('select').each(function (i, j) {
                $(j).find("option:selected").attr("selected", false);
                form.render('select')
            })
        });
        //表格排序
        table.on('sort(demo)', function(obj){
            table.reload('testReload', {
                initSort: obj //记录初始排序，如果不设的话，将无法标记表头的排序状态
                ,where: { //请求参数
                    field: obj.field //排序字段
                    ,order: obj.type //排序方式
                }
            });
        });
        //监听搜索
        form.on('submit(LAY-search)', function (data) {
            //执行重载
            table.reload('testReload', {
                page: {
                    curr: 1 //重新从第 1 页开始
                }
                ,where: data.field
            });
        });
    });
    //获取serialize数据转对象
    // $.fn.parseForm=function(){
    //     var serializeObj={};
    //     var array=this.serializeArray();
    //     var str=this.serialize();
    //     $(array).each(function(){
    //         if(serializeObj[this.name]){
    //             if($.isArray(serializeObj[this.name])){
    //                 serializeObj[this.name].push(this.value);
    //             }else{
    //                 serializeObj[this.name]=[serializeObj[this.name],this.value];
    //             }
    //         }else{
    //             serializeObj[this.name]=this.value;
    //         }
    //     });
    //     return serializeObj;
    // }
</script>
